<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/style.css" rel="stylesheet">
</head>

<body>
    <script>
        // let mn = readline().split(" ").map(Number);
        let m = 7
        let n = 2
        let arr = [[1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3]];
        // for (let i = 0; i < m; i++) {
        //     arr.push(readline().split(" ".map(Number)))
        // }
        let res = 0;
        // 分页
        let count = arr.length;
        let page = Math.ceil(count / 7);
        for (let i = 0; i < page; i++) {
            let max = 0;
            for (let j = 0; j < n; j++) {
                let grade = 0;
                for (let k = 0; k < 7; k++) {
                    if (!arr[7 * i + k]) {
                        break;
                    }
                    grade += arr[7 * i + k][j]
                }
                max = Math.max(max, grade)
            }
            res += max + 1;
        }
        console.log(res)
    </script>
</body>

</html>